<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en" >

<head>
  	<meta charset="UTF-8">
  	<title>Login Form</title>
	<link rel="stylesheet" href="../css/style.css">
</head>

<script src="../js/jquery-1.11.3.min.js"></script>

<body>
	<div class="login">
		<div class="login-screen">
			<div class="app-title">
				<h1>社联管理系统</h1>
				<h3>MMS-OA</h3>

			</div>
			<form id="loginForm" action="${ctx}/Login/check" monthed="post">


				<div class="login-form">
					<div class="control-group">
					<input type="text" class="login-field" name="ustuno" value="" placeholder="学号" id="login-name">
					<label class="login-field-icon fui-user" for="login-name"></label>
					</div>

					<div class="control-group">
					<input type="password" class="login-field" name="upassword" value="" placeholder="密码" id="login-pass">
					<label class="login-field-icon fui-lock" for="login-pass"></label>
					</div>

					<a class="btn btn-primary btn-large btn-block" href="#">login</a>
					<a class="login-link" href="#">忘记密码?</a>
				</div>
			</form>
		</div>
	</div>
</body>
<script type="text/javascript">

	$(function(){
        $('.btn-primary').click(function () {
            var username = $("input[name='ustuno']").val();
            var password = $("input[name='upassword']").val();
            if(username==""||password==""){
                alert("用户名或密码不能为空!");
                return false
            }
            var param ={
                ustuno:username,
                upassword:password
            }
            check(param);
        });

	})



	function check(formData){

        window.location.href="${ctx}/Login/index?ustuno="+formData.ustuno+"&upassword="+formData.upassword;

        /*
        $.ajax({
            type : 'post',
            url : url,
            data : formData,
            success : function(data) {
                console.log(data);

            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
            }
        });*/
    }
</script>


</html>
